package com.pkk.spring.cloud.gateway.runner.actuator;

import cn.hutool.core.util.StrUtil;
import com.pkk.spring.cloud.service.rpc.response.ResponseBody;
import com.pkk.spring.cloud.service.rpc.result.R;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.context.annotation.Configuration;

/**
 * 网关健康监测
 *
 * @author peikunkun
 * @version V1.0
 * @date 2021-01-15 11:06
 **/
@Configuration
@RestControllerEndpoint(id = "penguin-gateway")
public class PenguinGatewayControllerEndpoint {


  /**
   * 统一响应
   *
   * @return com.pkk.spring.cloud.service.rpc.response.ResponseBody<java.lang.String>
   * @Param message
   * @author peikunkun
   * @date 2021/1/15 0015 上午 11:33
   * @since
   */
  @ReadOperation
  public ResponseBody<String> ping(@Selector String message) {
    if (StrUtil.isBlank(message)) {
      return R.success("pang");
    }
    return R.success(message);
  }
}
